home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / tshell10.arc / EXAMPLE.PAS next >
Pascal/Delphi Source File  |  1991-04-28  |  2KB  |  77 lines

  1.  
  2. (*
  3.  * this program demonstrates and tests the facilities of TSHELL 1.0
  4.  *
  5.  *)
  6.  
  7. program tshell_tester;
  8.  
  9. {this statement will place a "signature" into the .com file where it can
  10.  be detected and used for configuration management}
  11. const example_tag: string[90]
  12.    = #0'@(#)CURRENT_FILE LAST_UPDATE Example program 1.0'#0;
  13.  
  14.  
  15. {define some macros}
  16. #define WHOAMI test program 1
  17. #define DEBUG     {this macro will control generation of debug code}
  18. #define LEV2      {this macro will enable low level debug code}
  19.  
  20.  
  21. begin
  22.  
  23. {test preprocessed source listing}
  24. #pragma LIST
  25.   {This will show during compilation}
  26.   writeln('whoami=WHOAMI');
  27. #pragma NOLIST
  28.  
  29.  
  30. {the following writeln should NOT be expanded}
  31. #pragma NOEXPAND
  32.   writeln('whoami=WHOAMI (shouldn''t say "test program 1")');
  33. #pragma EXPAND
  34.  
  35.  
  36. {test predefined symbols}
  37.   writeln('system_date=SYSTEM_DATE (date last compiled)');
  38.   writeln('last_update=LAST_UPDATE (date last updated)');
  39.   writeln('current_filename=CURRENT_FILE (source filename)');
  40.  
  41.  
  42. {test conditional compilation}
  43. #ifdef DEBUG
  44.    writeln('debug enabled');
  45.  
  46.    #ifdef LEV2
  47.       writeln('debug lev2');
  48.  
  49.       #ifdef LEV3
  50.          writeln('debug lev3');
  51.       #endif
  52.  
  53.    #else
  54.       writeln('debug not lev2');
  55.    #endif
  56.  
  57. #else
  58.    writeln('not debugging');
  59.  
  60.    #ifdef LEV2
  61.       writeln('not debug lev2');
  62.    #else
  63.       writeln('not debug not lev2');
  64.    #endif
  65. #endif
  66.  
  67.  
  68. {test the #undef command}
  69.  
  70. #define TEST1 Test-1
  71.    writeln('test1="TEST1" <-- should say Test-1');
  72.  
  73. #undef TEST1
  74.    writeln('test1="TEST1" <-- should say TEST1');
  75.  
  76. end.
  77.